* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index: contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index: trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index: blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index: tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset: 0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index: USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index: image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset: 0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index: meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-
2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset: 1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index: recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset: 5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index: wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property: stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property: stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property: stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property: stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index: comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset: 0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15
... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.
* @param $user User to fetch the list class for
* @return ChangesList derivative
*/
- function newFromUser( &$user ) {
+ public static function newFromUser( &$user ) {
$sk =& $user->getSkin();
$list = NULL;
if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) {
}
}
- function formatNum( $parser, $num = '' ) {
+ static function formatNum( $parser, $num = '' ) {
return $parser->getFunctionLang()->formatNum( $num );
}
- function grammar( $parser, $case = '', $word = '' ) {
+ static function grammar( $parser, $case = '', $word = '' ) {
return $parser->getFunctionLang()->convertGrammar( $word, $case );
}
- function plural( $parser, $text = '', $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null ) {
+ static function plural( $parser, $text = '', $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null ) {
return $parser->getFunctionLang()->convertPlural( $text, $arg0, $arg1, $arg2, $arg3, $arg4 );
}
- function displaytitle( $parser, $param = '' ) {
+ static function displaytitle( $parser, $param = '' ) {
$parserOptions = new ParserOptions;
$local_parser = clone $parser;
$t2 = $local_parser->parse ( $param, $parser->mTitle, $parserOptions, false );
return '';
}
- function isRaw( $param ) {
+ static function isRaw( $param ) {
static $mwRaw;
if ( !$mwRaw ) {
$mwRaw =& MagicWord::get( 'rawsuffix' );
}
}
- function statisticsFunction( $func, $raw = null ) {
+ static function statisticsFunction( $func, $raw = null ) {
if ( self::isRaw( $raw ) ) {
return call_user_func( array( 'SiteStats', $func ) );
} else {
}
}
- function numberofpages( $parser, $raw = null ) { return self::statisticsFunction( 'pages', $raw ); }
- function numberofusers( $parser, $raw = null ) { return self::statisticsFunction( 'users', $raw ); }
- function numberofarticles( $parser, $raw = null ) { return self::statisticsFunction( 'articles', $raw ); }
- function numberoffiles( $parser, $raw = null ) { return self::statisticsFunction( 'images', $raw ); }
- function numberofadmins( $parser, $raw = null ) { return self::statisticsFunction( 'admins', $raw ); }
+ static function numberofpages( $parser, $raw = null ) { return self::statisticsFunction( 'pages', $raw ); }
+ static function numberofusers( $parser, $raw = null ) { return self::statisticsFunction( 'users', $raw ); }
+ static function numberofarticles( $parser, $raw = null ) { return self::statisticsFunction( 'articles', $raw ); }
+ static function numberoffiles( $parser, $raw = null ) { return self::statisticsFunction( 'images', $raw ); }
+ static function numberofadmins( $parser, $raw = null ) { return self::statisticsFunction( 'admins', $raw ); }
- function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
+ static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) {
$count = SiteStats::pagesInNs( intval( $namespace ) );
if ( self::isRaw( $raw ) ) {
global $wgContLang;
}
}
- function language( $parser, $arg = '' ) {
+ static function language( $parser, $arg = '' ) {
global $wgContLang;
$lang = $wgContLang->getLanguageName( strtolower( $arg ) );
return $lang != '' ? $lang : $arg;
}
- function pad( $string = '', $length = 0, $char = 0, $direction = STR_PAD_RIGHT ) {
+ static function pad( $string = '', $length = 0, $char = 0, $direction = STR_PAD_RIGHT ) {
$length = min( max( $length, 0 ), 500 );
$char = substr( $char, 0, 1 );
return ( $string && (int)$length > 0 && strlen( trim( (string)$char ) ) > 0 )
: $string;
}
- function padleft( $parser, $string = '', $length = 0, $char = 0 ) {
+ static function padleft( $parser, $string = '', $length = 0, $char = 0 ) {
return self::pad( $string, $length, $char, STR_PAD_LEFT );
}
- function padright( $parser, $string = '', $length = 0, $char = 0 ) {
+ static function padright( $parser, $string = '', $length = 0, $char = 0 ) {
return self::pad( $string, $length, $char );
}
- function anchorencode( $parser, $text ) {
+ static function anchorencode( $parser, $text ) {
return str_replace( '%', '.', str_replace('+', '_', urlencode( $text ) ) );
}
- function special( $parser, $text ) {
+ static function special( $parser, $text ) {
$title = SpecialPage::getTitleForAlias( $text );
if ( $title ) {
return $title->getPrefixedText();
$options = array( $options );
}
if( is_array( $table ) ) {
- if ( @is_array( $options['USE INDEX'] ) )
+ if ( isset( $options['USE INDEX'] ) && is_array( $options['USE INDEX'] ) )
$from = ' FROM ' . $this->tableNamesWithUseIndex( $table, $options['USE INDEX'] );
else
$from = ' FROM ' . implode( ',', array_map( array( &$this, 'tableName' ), $table ) );
* Report an exception to the user
*/
function wfReportException( Exception $e ) {
- if ( is_a( $e, 'MWException' ) ) {
+ if ( $e instanceof MWException ) {
try {
$e->report();
} catch ( Exception $e2 ) {
* Override for page-based filter types.
* @return bool
*/
- function pass( $page, $string ) {
+ function pass( $page ) {
return true;
}
}
*/
function &wfGetDB( $db = DB_LAST, $groups = array() ) {
global $wgLoadBalancer;
- $ret =& $wgLoadBalancer->getConnection( $db, true, $groups );
+ $ret = $wgLoadBalancer->getConnection( $db, true, $groups );
return $ret;
}
?>
* @param string $name name of the image, used to create a title object using Title::makeTitleSafe
* @public
*/
- function newFromName( $name ) {
+ public static function newFromName( $name ) {
$title = Title::makeTitleSafe( NS_IMAGE, $name );
if ( is_object( $title ) ) {
return new Image( $title );
/**
* @static
*/
- function logName( $type ) {
+ public static function logName( $type ) {
global $wgLogNames;
if( isset( $wgLogNames[$type] ) ) {
/**
* @todo document
*/
- public function setEncodings() {
+ public static function setEncodings() {
global $wgInputEncoding, $wgOutputEncoding;
global $wgUser, $wgContLang;
$refers[$headlineCount] = $canonized_headline;
# count how many in assoc. array so we can track dupes in anchors
- @$refers[$canonized_headline]++;
+ isset( $refers[$canonized_headline] ) ? $refers[$canonized_headline]++ : $refers[$canonized_headline] = 1;
$refcount[$headlineCount]=$refers[$canonized_headline];
# Don't number the heading if it is the only one (looks silly)
$toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel);
}
# give headline the correct <h#> tag
- @$head[$headlineCount] .= "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
+ $head[$headlineCount] = "<a name=\"$anchor\"></a><h".$level.$matches[2][$headlineCount];
if( $showEditLink && ( !$istemplate || $templatetitle !== "" ) ) {
if ( empty( $head[$headlineCount] ) ) {
*/
function setHook( $tag, $callback ) {
$tag = strtolower( $tag );
- $oldVal = @$this->mTagHooks[$tag];
+ $oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null;
$this->mTagHooks[$tag] = $callback;
return $oldVal;
* @return The old callback function for this name, if any
*/
function setFunctionHook( $id, $callback, $flags = 0 ) {
- $oldVal = @$this->mFunctionHooks[$id];
+ $oldVal = isset( $this->mFunctionHooks[$id] ) ? $this->mFunctionHooks[$id] : null;
$this->mFunctionHooks[$id] = $callback;
# Add to function cache
/**
* Do any necessary preprocessing of the result object.
- * You should pass this by reference: &$db , &$res
+ * You should pass this by reference: &$db , &$res [although probably no longer necessary in PHP5]
*/
- function preprocessResults( $db, $res ) {}
+ function preprocessResults( &$db, &$res ) {}
/**
* Similar to above, but packaging in a syndicated feed instead of a web page
return $rc;
}
- /* static */ function newFromCurRow( $row, $rc_this_oldid = 0 )
+ public static function newFromCurRow( $row, $rc_this_oldid = 0 )
{
$rc = new RecentChange;
$rc->loadFromCurRow( $row, $rc_this_oldid );
if(!$wgUseTidy) {
$tagstack = $tablestack = array();
foreach ( $bits as $x ) {
- $prev = error_reporting( E_ALL & ~( E_NOTICE | E_WARNING ) );
$regs = array();
- preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs );
- list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
- error_reporting( $prev );
-
+ if( preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs ) ) {
+ list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
+ } else {
+ $slash = $t = $params = $brace = $rest = null;
+ }
+
$badtag = 0 ;
if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
# Check our stack
$skinName = $skinNames[$key];
# Grab the skin class and initialise it.
- wfSuppressWarnings();
// Preload base classes to work around APC/PHP5 bug
- include_once( "{$wgStyleDirectory}/{$skinName}.deps.php" );
- wfRestoreWarnings();
+ $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
+ if( file_exists( $deps ) ) include_once( $deps );
require_once( "{$wgStyleDirectory}/{$skinName}.php" );
# Check if we got if not failback to default skin
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
global $wgTitle, $wgCanonicalNamespaceNames, $wgOut;
- $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ];
- if ( $nsname === NULL ) $nsname = $wgTitle->getNsText();
-
+ $ns = $wgTitle->getNamespace();
+ $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+
$vars = array(
'jsmimetype' => $wgJsMimeType,
'skinname' => $this->getSkinName(),
}
function getSearchLink() {
- $searchPage =& SpecialPage::getTitleFor( 'Search' );
+ $searchPage = SpecialPage::getTitleFor( 'Search' );
return $searchPage->getLocalURL();
}
$tpl->set( 'displaytitle', $wgOut->mPageLinkTitle );
$tpl->set( 'pageclass', Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ) );
- $nsname = @$wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ];
- if ( $nsname === NULL ) $nsname = $this->mTitle->getNsText();
+ $nsname = isset( $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] ) ?
+ $wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ] :
+ $this->mTitle->getNsText();
$tpl->set( 'nscanonical', $nsname );
$tpl->set( 'nsnumber', $this->mTitle->getNamespace() );
} else {
$tpl->set( 'feeds', false );
}
- if ($wgUseTrackbacks && $out->isArticleRelated())
- $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF());
+ if ($wgUseTrackbacks && $out->isArticleRelated()) {
+ $tpl->set( 'trackbackhtml', $wgTitle->trackbackRDF() );
+ } else {
+ $tpl->set( 'trackbackhtml', null );
+ }
$tpl->setRef( 'mimetype', $wgMimeType );
$tpl->setRef( 'jsmimetype', $wgJsMimeType );
$href = self::makeSpecialUrl( "Contributions/$this->username" );
$personal_urls['mycontris'] = array(
'text' => wfMsg( 'mycontris' ),
- 'href' => $href
- # FIXME # 'active' => ( $href == $pageurl . '/' . $this->username )
+ 'href' => $href,
+ // FIXME # 'active' was disabed in r11346 with message: "disable bold link to my contributions; link was bold on all
+ // Special:Contributions, not just current user's (fix me please!)". Until resolved, explicitly setting active to false.
+ 'active' => false # ( ( $href == $pageurl . '/' . $this->username )
);
$personal_urls['logout'] = array(
'text' => wfMsg( 'userlogout' ),
'href' => self::makeSpecialUrl( 'Userlogout',
$wgTitle->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
- )
+ ),
+ 'active' => false
);
} else {
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
}
$nav_urls['specialpages'] = array( 'href' => self::makeSpecialUrl( 'Specialpages' ) );
-
+ // default permalink to being off, will override it as required below.
+ $nav_urls['permalink'] = false;
+
// A print stylesheet is attached to all pages, but nobody ever
// figures that out. :) Add a link...
if( $this->iscontent && ($action == '' || $action == 'view' || $action == 'purge' ) ) {
$nav_urls['recentchangeslinked'] = array(
'href' => $rclTitle->getLocalUrl()
);
+ } else {
+ $nav_urls['recentchangeslinked'] = false;
}
if ($wgUseTrackbacks)
$nav_urls['trackbacklink'] = array(
$nav_urls['contributions'] = array(
'href' => self::makeSpecialUrl( 'Contributions/' . $this->mTitle->getText() )
);
- if ( $wgUser->isAllowed( 'block' ) )
+ if ( $wgUser->isAllowed( 'block' ) ) {
$nav_urls['blockip'] = array(
'href' => self::makeSpecialUrl( 'Blockip/' . $this->mTitle->getText() )
- );
+ );
+ } else {
+ $nav_urls['blockip'] = false;
+ }
} else {
$nav_urls['contributions'] = false;
+ $nav_urls['blockip'] = false;
}
$nav_urls['emailuser'] = false;
if( $this->showEmailUser( $id ) ) {
* @private
*/
function haveData( $str ) {
- return $this->data[$str];
+ return isset( $this->data[$str] );
}
/**
$user = User::newFromName( $this->BlockAddress );
if( is_object( $user ) ) {
- $this->showLogFragment( $wgOut, $user->getUserPage() );
+ $page = $user->getUserPage();
+ $this->showLogFragment( $wgOut, $page );
} elseif( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $this->BlockAddress ) ) {
$this->showLogFragment( $wgOut, Title::makeTitle( NS_USER, $this->BlockAddress ) );
}
return new ImportStreamSource( $file );
}
- function newFromUpload( $fieldname = "xmlimport" ) {
+ static function newFromUpload( $fieldname = "xmlimport" ) {
$upload =& $_FILES[$fieldname];
if( !isset( $upload ) || !$upload['name'] ) {
return $ret;
}
- function newFromInterwiki( $interwiki, $page, $history=false ) {
+ public static function newFromInterwiki( $interwiki, $page, $history=false ) {
$link = Title::newFromText( "$interwiki:Special:Export/$page" );
if( is_null( $link ) || $link->getInterwiki() == '' ) {
return new WikiErrorMsg( 'importbadinterwiki' );
* $par string (optional) A group to list users from
*/
function wfSpecialListusers( $par = null ) {
- global $wgRequest, $wgContLang;
+ global $wgRequest;
list( $limit, $offset ) = wfCheckLimits();
}
function wfSpecialMIMEsearchParse( $str ) {
- wfSuppressWarnings();
+ // searched for an invalid MIME type.
+ if( strpos( $str, '/' ) === false) {
+ return array ('', '');
+ }
+
list( $major, $minor ) = explode( '/', $str, 2 );
- wfRestoreWarnings();
return array(
ltrim( $major, ' ' ),
$wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
$sk = $wgUser->getSkin();
- $undelete =& SpecialPage::getTitleFor( 'Undelete' );
+ $undelete = SpecialPage::getTitleFor( 'Undelete' );
$wgOut->addHTML( "<ul>\n" );
while( $row = $result->fetchObject() ) {
$title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
global $wgCommandLineMode;
global $wgRequest;
if( !$wgCommandLineMode && !isset( $_COOKIE[session_name()] ) ) {
- User::SetupSession();
+ wfSetupSession();
}
$form = new LoginForm( $wgRequest );
if ( $wgUser->isLoggedIn() ) {
$this->mName = $wgUser->getName();
} else {
- $this->mName = @$_COOKIE[$wgCookiePrefix.'UserName'];
+ $this->mName = isset( $_COOKIE[$wgCookiePrefix.'UserName'] ) ? $_COOKIE[$wgCookiePrefix.'UserName'] : null;
}
}
* @static
* @access public
*/
- function newFromURL( $url ) {
+ public static function newFromURL( $url ) {
global $wgLegalTitleChars;
$t = new Title();
* @return bool
* @static
*/
- function isError( &$object ) {
- return is_a( $object, 'WikiError' );
+ public static function isError( &$object ) {
+ return $object instanceof WikiError;
}
}
$titleStr = $info['title'];
$title = Title :: newFromText($titleStr);
$titleUrl = $title->getFullUrl();
- $comment = $info['comment'];
+ $comment = isset( $info['comment'] ) ? $info['comment'] : null;
$timestamp = $info['timestamp'];
$user = $info['user'];
return $this->mRequest;
}
- public function & getResult() {
+ public function getResult() {
return $this->mResult;
}
$isDirNewer = ($dir === 'newer');
$after = ($isDirNewer ? '>=' : '<=');
$before = ($isDirNewer ? '<=' : '>=');
- $db = & $this->getDB();
+ $db = $this->getDB();
if (!is_null($start))
$this->addWhere($field . $after . $db->addQuotes($start));
protected function select($method) {
// getDB has its own profileDBIn/Out calls
- $db = & $this->getDB();
+ $db = $this->getDB();
$this->profileDBIn();
$res = $db->select($this->tables, $this->fields, $this->where, $method, $this->options);
$vals = array ();
// ID
- @ $tmp = $row-> {
- $prefix . '_id' };
- if (!is_null($tmp))
- $vals[$prefix . 'id'] = intval($tmp);
+ if ( isset( $row-> { $prefix . '_id' } ) )
+ $vals[$prefix . 'id'] = intval( $row-> { $prefix . '_id' } );
// Title
$title = ApiQueryBase :: addRowInfo_title($row, $prefix . '_namespace', $prefix . '_title');
if (!is_null($tmp))
$vals['revid'] = intval($tmp);
- @ $tmp = $row->rc_last_oldid;
- if (!is_null($tmp))
- $vals['old_revid'] = intval($tmp);
+ if ( isset( $row->rc_last_oldid ) )
+ $vals['old_revid'] = intval( $row->rc_last_oldid );
$title = ApiQueryBase :: addRowInfo_title($row, 'rc_moved_to_ns', 'rc_moved_to_title');
if ($title) {
$vals['new_title'] = $title->getPrefixedText();
}
- @ $tmp = $row->rc_patrolled;
- if (!is_null($tmp))
+ if ( isset( $row->rc_patrolled ) )
$vals['patrolled'] = '';
break;
}
private static function addRowInfo_title($row, $nsfld, $titlefld) {
- @ $ns = $row-> $nsfld;
- if (!is_null($ns)) {
+ if ( isset( $row-> $nsfld ) ) {
+ $ns = $row-> $nsfld;
@ $title = $row-> $titlefld;
if (!empty ($title))
return Title :: makeTitle($ns, $title);
$count = 0;
$res = $this->select(__METHOD__);
- $db = & $this->getDB();
+ $db = $this->getDB();
while ($row = $db->fetchObject($res)) {
if (++ $count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
*/
function getNsIndex( $text ) {
$this->load();
- $index = @$this->mNamespaceIds[$this->lc($text)];
- if ( is_null( $index ) ) {
- return false;
- } else {
- return $index;
- }
+ $lctext = $this->lc($text);
+ return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false;
}
/**
function getMessage( $key ) {
$this->load();
- return @$this->messages[$key];
+ return isset( $this->messages[$key] ) ? $this->messages[$key] : null;
}
function getAllMessages() {
*/
static function getMessageFor( $key, $code ) {
self::loadLocalisation( $code );
- return @self::$mLocalisationCache[$code]['messages'][$key];
+ return isset( self::$mLocalisationCache[$code]['messages'][$key] ) ? self::$mLocalisationCache[$code]['messages'][$key] : null;
}
/**
}
# Turn off output buffering again, it might have been turned on in the settings files
-@ob_end_flush();
+if( ob_get_level() ) {
+ ob_end_flush();
+}
# Same with these
$wgCommandLineMode = true;
* @private
*/
function teardownUploadDir( $dir ) {
- unlink( "$dir/3/3a/Foobar.jpg" );
- rmdir( "$dir/3/3a" );
- rmdir( "$dir/3" );
- @rmdir( "$dir/thumb/6/65" );
- @rmdir( "$dir/thumb/6" );
-
- @unlink( "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" );
- @rmdir( "$dir/thumb/3/3a/Foobar.jpg" );
- @rmdir( "$dir/thumb/3/3a" );
- @rmdir( "$dir/thumb/3/39" ); # wtf?
- @rmdir( "$dir/thumb/3" );
- @rmdir( "$dir/thumb" );
- @rmdir( "$dir" );
+ // delete the files first, then the dirs.
+ self::deleteFiles(
+ array (
+ "$dir/3/3a/Foobar.jpg",
+ "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg",
+ "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg",
+ "$dir/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg",
+ "$dir/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg",
+ )
+ );
+
+ self::deleteDirs(
+ array (
+ "$dir/3/3a",
+ "$dir/3",
+ "$dir/thumb/6/65",
+ "$dir/thumb/6",
+ "$dir/thumb/3/3a/Foobar.jpg",
+ "$dir/thumb/3/3a",
+ "$dir/thumb/3",
+ "$dir/thumb",
+ "$dir",
+ )
+ );
}
+ /**
+ * @desc delete the specified files, if they exist.
+ * @param array $files full paths to files to delete.
+ */
+ private static function deleteFiles( $files ) {
+ foreach( $files as $file ) {
+ if( file_exists( $file ) ) {
+ unlink( $file );
+ }
+ }
+ }
+
+ /**
+ * @desc delete the specified directories, if they exist. Must be empty.
+ * @param array $dirs full paths to directories to delete.
+ */
+ private static function deleteDirs( $dirs ) {
+ foreach( $dirs as $dir ) {
+ if( is_dir( $dir ) ) {
+ rmdir( $dir );
+ }
+ }
+ }
+
/**
* "Running test $desc..."
* @private
'privacy', 'about', 'disclaimer', 'tagline',
);
foreach( $footerlinks as $aLink ) {
- if( $this->data[$aLink] ) {
+ if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
<?php }
}